package com.netstar.salesman_90dsp.engine;

import android.content.Context;

import com.loopj.android.http.RequestParams;
import com.netstar.salesman_90dsp.config.DefaultConfig;
import com.netstar.salesman_90dsp.config.WebServerConfig;
import com.netstar.salesman_90dsp.model.TodayWorkModel;

/**
 * 今日工作业务逻辑类
 * 
 * @author zhangshuai
 * 
 */
public class ToadayWorkEngine {
	/**
	 * 请求参数
	 */
	private RequestParams params;
	/**
	 * 上下文
	 */
	private Context context;

	public ToadayWorkEngine(Context context) {
		super();
		this.context = context;
	}

	/**
	 * 查询今日工作参数
	 * 
	 * @param pageNumber
	 * @param appointDate
	 *            指定日期
	 * @return
	 */
	public RequestParams getRequestParams(int pageNumber, String appointDate) {
		params = new RequestParams();
		params.put(WebServerConfig.TodayWorkListRequestParamKeys.page,
				pageNumber + "");
		params.put(WebServerConfig.TodayWorkListRequestParamKeys.rows,
				DefaultConfig.listShowRowNum + "");
		params.put(WebServerConfig.TodayWorkListRequestParamKeys.userId,
				DefaultConfig.userModel.getUserId());
		params.put(WebServerConfig.TodayWorkListRequestParamKeys.appointDate,
				appointDate);
		return params;
	}

	/**
	 * 删除工作参数
	 * 
	 * @param todayWorkModel
	 *            工作model
	 */
	public RequestParams deleteTodayWorkRequestParams(
			TodayWorkModel todayWorkModel) {
		params = new RequestParams();
		params.put(WebServerConfig.TodayWorkAddRequestParamKeys.id,
				todayWorkModel.getId());
		return params;
	}

	/**
	 * 提交今日工作参数
	 * 
	 * @param todayWorkModel
	 *            工作model
	 */
	public RequestParams completeRequestParams(TodayWorkModel todayWorkModel) {
		params = new RequestParams();
		params.put(WebServerConfig.TodayWorkAddRequestParamKeys.id,
				todayWorkModel.getId());
		params.put(WebServerConfig.TodayWorkAddRequestParamKeys.planDate,
				todayWorkModel.getPlanDate());
		params.put(WebServerConfig.TodayWorkAddRequestParamKeys.plans,
				todayWorkModel.getPlans());
		params.put(WebServerConfig.TodayWorkAddRequestParamKeys.state, "1");
		params.put(WebServerConfig.TodayWorkAddRequestParamKeys.userId,
				DefaultConfig.userModel.getUserId());
		return params;
	}
}
